package edu.ynu.hhy.architectureclass.controller;

import edu.ynu.hhy.architectureclass.service.TokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@Api(tags = "访问令牌的控制器")
@RestController
@RequestMapping("/token")
public class TokenController {

    @Autowired
    private TokenService tokenService;

    @ApiOperation("获取 FBox API 的访问令牌")
    @GetMapping("/fbox")
    public ResponseEntity<String> getFBoxToken() {
        String token = tokenService.getFBoxToken();
        return ResponseEntity.ok(token);
    }

    @ApiOperation("获取萤石 API 的访问令牌")
    @GetMapping("/ys")
    public ResponseEntity<String> getYsToken() {
        String token = tokenService.getYsToken();
        return ResponseEntity.ok(token);
    }
}
